package pages;

import org.openqa.selenium.By;

public class ParserBy {
	public static By parse(String locator) {
        if (locator.startsWith("id=")) {
            return By.id(locator.replace("id=", ""));
        }
        if (locator.startsWith("name=")) {
            return By.name(locator.replace("name=", ""));
        }
        if (locator.startsWith("link=")) {
            return By.linkText(locator.replace("link=", ""));
        }
        if (locator.startsWith("//")) {
            return By.xpath(locator);
        }
        return null;
    }
}
